package com.example.wechat.Adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;

/**
 * 创建ViewPager适配器
 */
public class Fg_Adapter extends FragmentPagerAdapter {
    //因为有多个Fragment，创建list装载
    private List<Fragment> fragments;
    public Fg_Adapter(@NonNull FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragments=fragments;
    }
    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
